package light.head.model.el;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;
/**
 * 题目信息表
 */
@Table
@Entity
public class Topic implements Serializable{

	private static final long serialVersionUID = 8057806825292891825L;
	
	private Integer code;
	private String content;				//题目
	private Integer tdc;				//难度编号
	private Byte type;					//类型(1.单选2.多选3.简答)
	private Float point;				//题目分值
	private Date ct;					//创建时间
	private Integer cu;					//创建时间
	private Integer oc;					//创建机构
	private Boolean deleted;
	
	private String tdn;					//题目难度
	private String cn;
	private String on;
	
	private List<TopicAnswer> itemList;	//题目答案
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public String getContent() {
		return content;
	}
	@Column
	public Integer getTdc() {
		return tdc;
	}
	@Column
	public Byte getType() {
		return type;
	}
	@Formula("(SELECT l.point FROM TopicDifficulty l WHERE l.code = tdc)")
	public Float getPoint() {
		return point;
	}
	@Column
	public Date getCt() {
		return ct;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Formula("(SELECT td.name FROM TopicDifficulty td WHERE td.code=tdc)")
	public String getTdn() {
		return tdn;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code=cu)")
	public String getCn() {
		return cn;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code=oc)")
	public String getOn() {
		return on;
	}
	@Transient
	public List<TopicAnswer> getItemList() {
		return itemList;
	}

	
	
	
	
	
	public void setCode(Integer code) {
		this.code = code;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public void setTdc(Integer tdc) {
		this.tdc = tdc;
	}

	public void setType(Byte type) {
		this.type = type;
	}

	public void setPoint(Float point) {
		this.point = point;
	}

	public void setCt(Date ct) {
		this.ct = ct;
	}

	public void setCu(Integer cu) {
		this.cu = cu;
	}

	public void setOc(Integer oc) {
		this.oc = oc;
	}

	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

	public void setTdn(String tdn) {
		this.tdn = tdn;
	}

	public void setCn(String cn) {
		this.cn = cn;
	}

	public void setOn(String on) {
		this.on = on;
	}

	public void setItemList(List<TopicAnswer> itemList) {
		this.itemList = itemList;
	}
	
	

}
